package com.iplant.mes.service;

import com.iplant.ams.service.po.dms.scada.conf.DMSDeviceParameter;
import com.iplant.ams.service.po.dms.scada.para.DMSDeviceRealParameter;
import com.iplant.aps.service.po.aps.APSTaskPartPointDay;
import com.iplant.base.po.OutResult;
import com.iplant.base.po.Pagination;
import com.iplant.base.po.ServiceResult;
import com.iplant.basic.service.basicenum.bfc.BaseTagType;
import com.iplant.basic.service.po.bms.BMSEmployee;
import com.iplant.mes.service.po.bcm.BCMRuleCode;
import com.iplant.mes.service.po.ipt.IPTValue;
import com.iplant.mes.service.po.print.SFCFactoryTest;
import com.iplant.mes.service.po.sfc.*;
import com.iplant.mes.service.po.sfc.autoStation.SFCDeviceReport;
import com.iplant.mes.service.po.sfc.autoStation.SFCDeviceSelfData;
import com.iplant.mes.service.po.sfc.autoStation.SFCStatusFeedback;
import com.iplant.mes.service.po.sfc.autoStation.SFCTaskSelfParam;
import com.iplant.pdm.service.po.bop.partpoint.FPCRouteStep;

import java.util.Calendar;
import java.util.List;
import java.util.Map;

public interface SFCService {

    //region 派工
    ServiceResult<Integer> SFC_SaveDispatchResult(BMSEmployee wLoginUser, List<SFCTaskSelf> wSFCTaskSelfList);

    ServiceResult<List<SFCTaskSelf>> SFC_QuerySFCTaskSelfCurrent(BMSEmployee wLoginUser, String wStationCode,
                                                                 int wIsAll, int wIsUser);

    ServiceResult<Integer> SFC_DeleteTaskSelf(BMSEmployee wLoginUser, SFCTaskSelf wSFCTaskSelf);
    //endregion

    //region 开工打卡
    ServiceResult<List<SFCTaskSelf>> SFC_QueryClockTask(BMSEmployee wLoginUser, Map<String, Object> wParams,
                                                        Pagination wPagination);

    ServiceResult<Integer> SFC_BatchClock(BMSEmployee wLoginUser, List<SFCTaskSelf> wSFCTaskSelfList);

    //endregion

    //region 检验
    ServiceResult<List<SFCTaskIPT>> SFC_QueryCheckTask(BMSEmployee wLoginUser, BaseTagType wBaseTagType,
                                                       Calendar wStartTime, Calendar wEndTime,
                                                       Map<String, Object> wParams, Pagination wPagination);

    ServiceResult<Integer> IPT_QueryDetailsByTask(BMSEmployee wLoginUser, int wTaskID);

    ServiceResult<Integer> IPT_SubmitValue(BMSEmployee wLoginUser, List<IPTValue> wIPTValueList, boolean wIsDevice,
                                           boolean wIsSave);

    ServiceResult<List<FPCRouteStep>> SFC_QueryItemsByStation(BMSEmployee wLoginUser, int wStationID, int wCheckType);

    ServiceResult<SFCTaskIPT> SFC_CreateTaskByWorkpieceNo(BMSEmployee wLoginUser, int wStationID, int wCheckType,
                                                          String wWorkpieceNo);

    ServiceResult<Integer> SFC_AutoReport(BMSEmployee wLoginUser, SFCTaskIPT wSFCTaskIPT);

    ServiceResult<List<SFCTaskIPT>> SFC_QueryReportTaskIPIList(BMSEmployee wLoginUser, Map<String, Object> wParams);

    ServiceResult<Integer> SFC_HandReport(BMSEmployee wLoginUser, List<SFCTaskIPT> wSFCTaskIPTList);

    void UpdatesPlanRealTimeProgress(BMSEmployee wLoginUser, List<Integer> wTaskSelftIDList,
                                     List<Integer> wTaskPartPointDayIDList,
                                     OutResult<Integer> wErrorCode);

    ServiceResult<List<FPCRouteStep>> SFC_QueryCheckItemsByOrder(BMSEmployee wLoginUser, int wOrderID,
                                                                 int wRoutePartID, int wRoutePartPointID);

    ServiceResult<SFCTaskIPT> SFC_CreateSpecialCheckTaskByOrder(BMSEmployee wLoginUser, int wOrderID,
                                                                int wRoutePartID, int wRoutePartPointID,
                                                                String wWorkpieceNo);

    ServiceResult<String> SFC_CheckWorkpieceValue(BMSEmployee wLoginUser, SFCTaskIPT wSFCTaskIPT, IPTValue wIPTValue);

    ServiceResult<Integer> SFC_BindingNo(BMSEmployee wLoginUser, SFCTaskIPT wSFCTaskIPT, List<IPTValue> wIPTValueList);

    ServiceResult<List<SFCTaskReport>> SFC_QueryToConfirmList(BMSEmployee wLoginUser, Map<String, Object> wParams,
                                                              Pagination wPagination);

    ServiceResult<Integer> SFC_TaskReportConfirm(BMSEmployee wLoginUser, SFCTaskReport wSFCTaskReport);

    ServiceResult<Integer> SFC_BindingFrockBindRecord(BMSEmployee wLoginUser,
                                                      List<SFCFrockBindRecord> wSFCFrockBindRecordList);

    ServiceResult<Integer> SFC_UnBindingFrockBindRecord(BMSEmployee wLoginUser,
                                                        List<SFCFrockBindRecord> wSFCFrockBindRecordList);

    ServiceResult<Integer> SFC_BoxReport(BMSEmployee wLoginUser, List<SFCWorkpieceRecord> wSFCWorkpieceRecordList);

    ServiceResult<SFCBoxReport> SFC_QueryBoxReportInfo(BMSEmployee wLoginUser, int wBoxReportID);

    ServiceResult<List<SFCTaskIPT>> SFC_QueryToSpecialTaskList(BMSEmployee wLoginUser, String wComponentCode);

    ServiceResult<Integer> SFC_DeleteTaskIPTList(BMSEmployee wLoginUser, List<SFCTaskIPT> wSFCTaskIPTList);

    ServiceResult<Integer> SFC_DeleteTaskIPT(BMSEmployee wLoginUser, SFCTaskIPT wSFCTaskIPT);

    ServiceResult<List<IPTValue>> SFC_QueryValueList(BMSEmployee wLoginUser, Map<String, Object> wParams,
                                                     Pagination wPagination);
    //endregion

    //region 开工检查
    ServiceResult<Integer> SFC_SubmitTaskStartCheckRecord(BMSEmployee wLoginUser, SFCTaskStartCheck wSFCTaskStartCheck);

    void CheckDevicePointCheck(BMSEmployee wLoginUser, int wTaskSelfID, OutResult<Integer> wErrorCode);

    ServiceResult<Integer> SFC_SFCTaskSelfParamPrevCheck(BMSEmployee wLoginUser, SFCTaskSelfParam wSFCTaskSelfParam);
    //endregion

    //region 计划相关
    ServiceResult<Integer> APS_IssueDayPlanList(BMSEmployee wLoginUser,
                                                List<APSTaskPartPointDay> wAPSTaskPartPointDayList);

    //endregion

    //region 工控机
    ServiceResult<Integer> SFC_QueryMainInterfaceDataAll(BMSEmployee wLoginUser, String ipAddress, int wShiftType);

    ServiceResult<List<SFCTaskSelf>> SFC_QueryResumptionList(BMSEmployee wLoginUser, String ipAddress, int wShiftType);

    ServiceResult<Integer> SFC_NumberReport(BMSEmployee wLoginUser, SFCTaskReport wSFCTaskReport);

    ServiceResult<Integer> SFC_TrayBindingComponents(BMSEmployee wLoginUser, String wTrayCode, String wComponentCodes
            , List<SFCTaskSelf> wSFCTaskSelfList, String wMoldCode);

    ServiceResult<SFCTaskIPT> SFC_CreateTaskByWorkpieceNoAndTask(BMSEmployee wLoginUser, int wStationID,
                                                                 int wCheckType, String wWorkpieceNo,
                                                                 SFCTaskSelf wSFCTaskSelf);

    ServiceResult<Integer> SFC_TrayUnBindComponents(BMSEmployee wLoginUser, String wTrayCode);

    ServiceResult<List<FPCRouteStep>> SFC_QueryItemsByStationAndTask(BMSEmployee wLoginUser, int wStationID,
                                                                     int wCheckType, SFCTaskSelf wSFCTaskSelf,
                                                                     boolean wIsSpotCheck);

    ServiceResult<Integer> SFC_WorkpieceAssembly(BMSEmployee wLoginUser, String wSourceCodes, String wTargetCode,
                                                 SFCTaskSelf wSFCTaskSelf, int wAssemblyType);

    ServiceResult<Integer> SFC_SaveTrayBindingComponents(BMSEmployee wLoginUser, String wTrayCode,
                                                         String wComponentCodes, List<SFCTaskSelf> wSFCTaskSelfList);

    ServiceResult<List<DMSDeviceRealParameter>> SFC_QueryParamsByTaskID(BMSEmployee wLoginUser, int wTaskSelfID);
    //endregion

    //region 产品追溯
    ServiceResult<List<SFCWorkpieceRecord>> SFC_WorkpieceRecordAll(BMSEmployee wLoginUser, String wMaterialBarcode,
                                                                   Calendar wStartTime, Calendar wEndTime, Map<String
            , Object> wParams, int wDeviceID, int wStationID, Pagination wPagination);

    ServiceResult<Integer> SFC_QueryWorkpieceCirculateDetails(BMSEmployee wLoginUser, int wWorkpieceResumeID);

    ServiceResult<Integer> SFC_WorkpieceRecordScrap(BMSEmployee wLoginUser, SFCWorkpieceRecord wSFCWorkpieceRecord);

    ServiceResult<Integer> SFC_DeviceReport(BMSEmployee wLoginUser, SFCDeviceReport wSFCDeviceReport);

    ServiceResult<Integer> SFC_DeviceUpdateProduct(BMSEmployee wLoginUser,
                                                   SFCStatusFeedback wSFCStatusFeedback);

    ServiceResult<Integer> SFC_DeviceBatchSelfCheck(BMSEmployee wLoginUser,
                                                    List<SFCDeviceSelfData> wSFCDeviceSelfDataList);

    ServiceResult<SFCWorkpieceRecord> SFC_QueryWorkpiecesJobDetails(BMSEmployee wLoginUser, int wWorkpieceRecordID);

    ServiceResult<List<DMSDeviceParameter>> SFC_QueryParams(BMSEmployee wLoginUser, String wWorkpieceNo,
                                                            int wRoutePartID, int wRoutePartPointID, int wStationID);

    ServiceResult<List<DMSDeviceParameter>> QueryParamsByStationIDs(BMSEmployee wLoginUser, List<Integer> wStationIDs
            , List<Integer> wDataClassList);

    ServiceResult<List<Map<String, Object>>> QueryDeviceRecord(BMSEmployee wLoginUser, String wWorkpieceNo,
                                                               int wRoutePartID, int wRoutePartPointID,
                                                               int wStationID, int wDeviceID);
    //endregion

    //region 出厂试验单打印
    ServiceResult<SFCFactoryTest> SFC_QueryFactoryTest(BMSEmployee wLoginUser, String wWorkpieceNos);

    ServiceResult<String> SFC_ExportFactoryTest(BMSEmployee wLoginUser, SFCFactoryTest wSFCFactoryTest);

    ServiceResult<BCMRuleCode> SFC_CreateBarCodeByTask(BMSEmployee wLoginUser, SFCTaskSelf wSFCTaskSelf);
    //endregion
}
